package data

import (
	"crypto/md5"
	"encoding/hex"
	"strings"

	uuid "github.com/satori/go.uuid"
)

type PageList struct {
	CurrentPage int64       `json:"page"`
	PageSize    int64       `json:"page_size"`
	Total       int64       `json:"total"`
	List        interface{} `json:"list"`
}

type Count struct {
	Total int64 `json:"total"`
}

type Area struct {
	Id       int64 `json:"id"`
	ParentId int64 `json:"parent_id"`
	Level    int64 `json:"level"`
}

// 生成UUID字符串
func CreateKey() string {
	key := uuid.NewV4()
	return strings.Replace(key.String(), "-", "", -1)
}

//对字节流进行MD5加密
func ByteMd5(ByteStream []byte) string {
	h := md5.New()
	h.Write(ByteStream)
	str := strings.ToUpper(hex.EncodeToString(h.Sum(nil)))
	return str
}
